﻿@using System.Text
@using OA.Model
@using OA.AspNetCore.Html
@using OA.Core.Model
@using OA.Core.Helper

@model OA.Model.DB.Product
@{

    Layout = null;
    string msg = ViewBag.Msg;
    string tips = string.Empty;
    if (!string.IsNullOrWhiteSpace(msg))
    {
        tips = $"layer.msg('{msg}');";
    }

}



<div class="layui-my-content">
    <div class="myForm">
        @using (Html.BeginForm(FormMethod.Post, htmlAttributes: new { @class = "layui-form", id = "myForm" }))
        {
            @Html.AntiForgeryToken()
            <div class="layui-form-item">
                @Html.LabelFor(model => model.Name, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.HiddenFor(model => model.ID)
                    @Html.MyEditorFor(model => model.Name)
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">产品类别</label>
                <div class="layui-input-block myDepartment">

                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.No, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.No)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.SpecificationsModel, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.SpecificationsModel)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.Unit, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.Unit)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.ProcessingCost, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.ProcessingCost)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.Weight, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.Weight)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.AllStock, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.AllStock)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.IsProduction, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.IsProduction)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.IsPurchase, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.IsPurchase)
                </div>
            </div>

            <div class="layui-form-item">
                @Html.LabelFor(model => model.Descriptions, new { @class = "layui-form-label" })
                <div class="layui-input-block">
                    @Html.MyEditorFor(model => model.Descriptions)
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="submit" value="提 交" lay-submit="" lay-filter="OAForm" class="layui-btn mySubmit" />
                </div>
            </div>
        }
    </div>
</div>
<script type="text/javascript" src="/Member/Home/GetProductCategory"></script>
<script type="text/javascript" src="@ViewBag.OssUrl/front/js/department.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layedit', 'element', 'layer', 'util'], function () {
		form = layui.form;
        layer = layui.layer;
        element = layui.element;
        util = layui.util;
        form.on('select(Department)', function (data) {
            InitDepartment($(".myDepartment"), data.value);           
            form.render('select');
        });
        InitDepartment($(".myDepartment"), @Model.CategoryID);
        form.render('select');         
     });
     
</script>